﻿function test1(str){return/onetwothree/g.exec(str)}function test2(str){var match,re=/the/g;try{while(match=re.exec(str))alert(match[0])}catch(e){}}function test3(){return["one","two","three","four"].foo()}function test4(ndx){var ndx=0,arr=["one","two","three","four"];do alert(++ndx);while(arr.shift());return ndx}function test5(ndx){for(var ndx=0,arr=["one","two","three","four"],first;first=arr.shift();++ndx)alert(first);return ndx}function test6(){for(var arr=["one","two","three","four"],first="zero";first;first=arr.shift())alert(first)}function test7(str){for(var re=/the/g,match;;){if(match=re.exec(str),!match)break;alert(match[0])}}